package com.hisan.freeride.common.Dialog;

import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.hisan.freeride.R;
import com.hisan.freeride.common.event.DataSynEvent;
import com.mylhyl.circledialog.BaseCircleDialog;

import org.greenrobot.eventbus.EventBus;

/**
 * 创建时间 : 2017/6/19
 * 创建人：yangyingqi
 * 公司：嘉善和盛网络有限公司
 * 备注：积分兑换验证成功弹窗
 */
public class MallDialogLogok extends BaseCircleDialog implements View.OnClickListener  {
    
    public static MallDialogLogok getInstance() {
        MallDialogLogok dialogFragment = new MallDialogLogok();
        dialogFragment.setCanceledBack(true);
        dialogFragment.setCanceledOnTouchOutside(false);
        dialogFragment.setGravity(Gravity.CENTER);
        dialogFragment.setRadius(4);
        dialogFragment.setWidth(1f);
        return dialogFragment;
    }

    @Override
    public View createView(Context context, LayoutInflater inflater, ViewGroup container) {
        return inflater.inflate(R.layout.dialog_logok, container, false);
    }

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.ok) {
            dismiss();
            EventBus.getDefault().post(new DataSynEvent(1));
            //注销逻辑
        }
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        View view = getView();
        view.findViewById(R.id.ok).setOnClickListener(this);
        TextView textView= (TextView) view.findViewById(R.id.name);
        textView.setText("兑换成功！！");
    }
}
